package com.vne.skyemart.model;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class CartItemID implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 7980849875641377968L;

	private Products products;
	private Cart cart;
	/**
	 * GETTER AND SETTER
	 * 
	 */
	@ManyToOne
	public Products getProducts() {
		return products;
	}
	public void setProducts(Products products) {
		this.products = products;
	}
	public Cart getCart() {
		return cart;
	}
	@ManyToOne
	public void setCart(Cart carts) {
		this.cart = carts;
	}
	/*
	 * OTHER
	 * 
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null || getClass() != obj.getClass())
			return false;
		CartItemID cartItemID = new CartItemID();
		if (cart != null ? !cart.equals(cartItemID.cart) : cartItemID.cart != null)
			return false;
		if (products != null ? !products.equals(cartItemID.products) : cartItemID.products != null)
			return false;
		return true;
	}
	@Override
	public int hashCode() {
		int result;
		result = (cart != null ? cart.hashCode() : 0);
		result = 31 * result + (products != null ? products.hashCode() : 0);
		return result;
	}	
}
